package cn.tedu.boot10.controller;


import cn.tedu.boot10.entity.Student;
import cn.tedu.boot10.mapper.StudentMapper;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.RequestBody;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.RestController;

import java.util.List;

@RestController
@RequestMapping("/student/")
public class StudentController {
    @Autowired
    StudentMapper mapper;

    @RequestMapping("selectByCid")
    public List<Student> selectByCid(int id) {
        return mapper.selectByCid(id);
    }

    /*
     * @RequestMapping("insert")
     * public List<Class> insert(@RequestBody Class c){
     * mapper.insert(c);
     * return mapper.select();
     * }
     * */
    @RequestMapping("insert")
    public void insert(@RequestBody Student s) {
        mapper.insert(s);
    }

    @RequestMapping("delete")
    public void delete(int id) {
        mapper.deleteById(id);
    }
}
